package com.study.designpattern.singleton;

/**
 * --------单例模式（懒汉式）------
 * -------线程安全------
 */
public class SingletonSafe {
    private static SingletonSafe singletonSafe;

    private SingletonSafe(){}

    public static synchronized SingletonSafe getSingletonSafe(){
        if (singletonSafe==null){
            singletonSafe=new SingletonSafe();
        }
        return singletonSafe;
    }

    public void say(){
        System.out.println("Hello World!");
    }
}
